The present invention relates to a video bitrate control method for a video coding system, said coding system generating coded video frames stored in a storage device and originating from a sequence of input frames, said method comprising at least a quantization step for applying a quantization factor to said input frames.
This invention may be used in video coding systems, such as MPEG-2 video encoders or transcoders.
The MPEG-2 video compression standard (Moving Pictures Experts Group), referred to as ISO/IEC 13818-2, is not only used for broadcasting applications but also for recording applications. This standard is indeed used for generating compressed video sequences to be stored on digital a video disc (DVD). To this end, many techniques can be envisaged. One consists of encoding input frames so that the resulting output signal containing MPEG-2 encoded frames has a constant bit rate (CBR). Another one consists of encoding input frames so that the resulting output signal has a variable bit rate (VBR). The first approach is very convenient since the storing of encoded video frames on a space-limited storage device is guaranteed, but it is to the detriment of video quality, which may fluctuate because input frames do not require the same amount of bits in dependence on their complexity. The second approach ensures a fairly constant quality of the overall encoded frames because the amount of bits allocated increases with frame complexity. However, the control of this process does not allow a prediction of the amount of bits generated, which is not fixed, and as a consequence the storing of said encoded frames on a space-limited storage device is not guaranteed and may lead to large bit overflows and underflows.
The international patent application WO 99/49664 describes a method of regulating the bitrate of encoded video frames to a constant overall value, but resulting in a locally variable output bitrate. To this end, a target bitrate is determined for successive sets of frames to be encoded in view of determining a target encoding quality. The target bitrate is derived from differences between previous and actual target bitrates. The actual target is made variable according to the scene complexity and to the target encoding quality of each set of frames.
It is an object of the invention to propose an improved video bitrate control method allowing the storing of a compressed sequence of frames at constant quality on a space-limited storage device.
The method proposed in the prior art has functional limitations when it is used in the coding of a sequence of video frames on a space-limited storage device.
First, problems may occur at the end of the sequence encoding if the output VBR fluctuates with large amplitude. In this case, the bitrate allocation for the remaining frames to be encoded becomes hazardous, leading to a probable overflow or underflow of the storage device capacity. As a consequence, the optimal convergence of frame storing is not always guaranteed, e.g. all the frames contained in the input sequence cannot be stored.
Secondly, the constant quality of the encoded frames claimed by this method is not always guaranteed. Indeed, the target encoding quality is modified on the basis of differences between a current bitrate target and a bitrate target relative to a previous set of frames. Since at a given bitrate target a same quality is not obtained, depending on whether the frame complexity is low or high, the change of the target encoding may oscillate, leading to local temporary visual quality fluctuations.
The method according to the invention aims to provide a solution to the limitations of the prior art method. To this end, the method according to the invention is characterized in that the evaluation of the quantization factor comprises:
a calculation sub-step for calculating the previous coded frame complexity X(nxe2x88x921) from its quantization factor Q(nxe2x88x921) and its frame size S(nxe2x88x921),
a first estimation sub-step for estimating the current input frame complexity Xe(n) from at least the complexity X(nxe2x88x921),
a second estimation sub-step for estimating the frame size R(n) of the current input frame after coding from the number of bits available on the storage device and the remaining number of frames to code in the input sequence, and
a third estimation sub-step for estimating the quantization factor to be applied to the current input frame from the current input frame complexity Xe(n) and the estimated frame size R(n).
This method allows the system to obtain a constant quality for coded frames of the sequence. It takes into consideration statistics of previous coded frames in order to evaluate a complexity of the current frame to be coded. This evaluation is characterized in that it is performed by a mechanism including a time constant so that the estimated complexity is smoothed along coded frames. In parallel, a current bit target for the frame being coded is estimated in relation to the remaining space available on the storage device and the remaining number of frames to be coded. Then, on the basis of the estimated complexity and the estimated current bit target, a quantizer step is derived and used for quantifying discrete cosine transform (DCT) coefficients defining the frame being coded. As a consequence, this quantizer step has smoothed relative variations among frames, which results in an output bitrate relative to coded frames having a VBR behavior, and leads to a constant or slowly varying quality of the coded video frames.
This method is also characterized in that the time constant is a function of the number of coded video frames on the storage device and the remaining number of video frames to be coded in the sequence.
This allows controlled variations of the output bitrate relative to coded frames, mainly at the beginning and at the end of the sequence coding. Thus, the bitrate is controlled for varying from a CBR to a VBR behavior in view of a coding parameters setting, and from a VBR to a CBR behavior for ensuring the storage of all frames of the input sequence on the storage device. Such transitory states, based on the variation of the time constant value with respect to the rank of the current frame in the sequence, corresponds to constrained VBR behavior changes guaranteeing optimal filling of the storage device in terms of quality and space. Of course, this method allows obtaining a VBR behavior during the coding processing.